package com.hjl.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author ServivE
 * @version 0.1
 * @className UserController
 * @description
 * @date 2024/8/13 15:20
 * @since jdk17
 */
@RequestMapping("user")
@Controller
public class UserController {

    //空指针异常
    @GetMapping("data")//NullPointerException
    public String data() {
        String a = null;
        a.toString();
        System.out.println("a = " + a);
        return a;
    }

    //数据运算异常
    @GetMapping("data1")//ArithmeticException:
    public int data1() {
        int a = 1 / 0;
        System.out.println("a = " + a);
        return a;
    }
}
